/**
 * 任务名称
 * name: serv00注册查询
 * 定时规则
 * cron: 0 9,15 * * *
 */
const notify = require('../sendNotify');
const { JSDOM } = require("jsdom");

const serv00_url = 'https://www.serv00.com';
(async () => {
  try {
    fetch(serv00_url)
      .then(res => res.text())
      .then(text => {
        const dom = new JSDOM(text);
        const $btn = dom.window.document.querySelector('span.button.is-large.is-flexible')
        const message = $btn.textContent.match(/(\d+)\s\/\s(\d+)/)[0]
        // 企业微信机器人消息推送
        notify.sendNotify('serv00注册查询', `${message}\n${serv00_url}`, {group: '注册查询'});
      })
  } catch (error) {
    console.error('数据获取失败:', error);
  }
})();
